{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example: Designing different divertor configurations\n", "\n", "---\n", "\n", "Here we show how to use the static inverse solver to make changes to the divertor legs, while holding the plasma core fixed. We make a few different divertor configurations, that correspond to larger flux expansion, connection lengths, and therefore heat fluxes. \n", "- conventional divertor (CD), as seen many time before in these notebooks. \n", "- elongated divertor (ED). \n", "- super-X divertor (SXD). \n", "- X-point target (XPT). \n", "\n", "We will check the equilibria vs our constraints and ensure that coil limits are not violated.\n", "\n", "### Starting equilibrium\n", "\n", "Build the MAST-U-like machine and solve for an initial free-boundary equilibrium using the static forward solver (with prescribed coil currents). " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Build the MAST-U-like machine.\n", "import numpy as np\n", "from freegsnke import build_machine\n", "tokamak = build_machine.tokamak(\n", " active_coils_path=\"../machine_configs/MAST-U/MAST-U_like_active_coils.pickle\",\n", " passive_coils_path=\"../machine_configs/MAST-U/MAST-U_like_passive_coils.pickle\",\n", " limiter_path=\"../machine_configs/MAST-U/MAST-U_like_wall.pickle\",\n", " wall_path=\"../machine_configs/MAST-U/MAST-U_like_wall.pickle\",\n", ")\n", "\n", "# Set up the equilibrium grid.\n", "from freegsnke import equilibrium_update\n", "from freegsnke.jtor_update import ConstrainPaxisIp\n", "\n", "eq = equilibrium_update.Equilibrium(\n", " tokamak=tokamak,\n", " Rmin=0.1,\n", " Rmax=2.0,\n", " Zmin=-2.2,\n", " Zmax=2.2,\n", " nx=65,\n", " ny=129,\n", ")\n", "\n", "# Set the plasma profile.\n", "from freegsnke.jtor_update import Lao85\n", "profiles = Lao85(\n", " eq=eq,\n", " Ip=744117,\n", " fvac=-0.47,\n", " alpha=np.array([418995.30508349, 10291.92267398]),\n", " beta=np.array([0.36624991, 0.05139343]),\n", " alpha_logic=True,\n", " beta_logic=True, \n", ")\n", "\n", "# Set up the static Grad–Shafranov solver.\n", "from freegsnke import GSstaticsolver\n", "GSStaticSolver = GSstaticsolver.NKGSsolver(eq, gs_operator_order=4)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# apply some starting PF coil currents\n", "current_values = {\n", " 'Solenoid': -9832.358940664852,\n", " 'PX': 2146.99751691171,\n", " 'D1': 4712.206686638823,\n", " 'D2': 5311.404252957054,\n", " 'D3': -1495.067768034757,\n", " 'Dp': -3747.2015273389216,\n", " 'D5': -1372.8402949519268,\n", " 'D6': -337.80910404610916,\n", " 'D7': 890.1958007147839,\n", " 'P4': -3250.4415739978294,\n", " 'P5': -5449.769306785791,\n", " 'P6': -66.34934177326818,\n", "}\n", "\n", "for key in current_values.keys():\n", " eq.tokamak.set_coil_current(coil_label=key, current_value=current_values[key])\n", "\n", "GSStaticSolver.solve(\n", " eq=eq,\n", " profiles=profiles,\n", " constrain=None,\n", " target_relative_tolerance=1e-7,\n", " verbose=True,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So here we have the standard CD equilibrium. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "# Plot the starting equilibrium.\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=80)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, 2.25)\n", "plt.tight_layout()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Elongated Divertor (ED)\n", "\n", "Using the inverse solver, we can choose a set of isoflux constraints that will hold the core fixed, while moving the leg to the desired position (via the strikepoint)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, we define a short function that takes in the contour defining the divertor and a radial co-ordinate, returning the corresponding Z co-ordinate. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from shapely.geometry import LineString\n", "\n", "def Z_at_R(line, R):\n", " \"\"\"Return all Z-values where a Shapely line crosses R.\"\"\"\n", " \n", " _, Zmin, _, Zmax = line.bounds\n", " vertical = LineString([(R, Zmin - 1), (R, Zmax + 1)])\n", " intersection = line.intersection(vertical)\n", "\n", " if intersection.is_empty:\n", " return np.array([])\n", "\n", " if intersection.geom_type == \"Point\":\n", " return np.array([intersection.y])\n", "\n", " if intersection.geom_type == \"MultiPoint\":\n", " return np.array([point.y for point in intersection.geoms])\n", "\n", " raise ValueError(f\"Line overlaps R={R}; Z is not unique.\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# define the lower divertor chamber wall\n", "lower_divertor_line = np.array(\n", " [[0.5345, -1.514], [1.0882, -2.0661], [1.3485, -2.0652], [1.7302, -1.6810]]\n", ")\n", "divertor_line = LineString(lower_divertor_line)\n", "\n", "# choose location of the strikepoint\n", "r_strike = 1.12\n", "z_strike = Z_at_R(line=divertor_line, R=r_strike)\n", "print(z_strike)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# show the proposed new strikepoint\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=120)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "ax1.scatter(r_strike, z_strike, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, -1)\n", "plt.tight_layout()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we define the constraints for the inverse problem." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np \n", "from freegsnke.inverse import Inverse_optimizer\n", "\n", "# extract the X-points inside the first wall\n", "xpts = eq.xpt[0:2,0:2]\n", "\n", "# extract a few points on the plasma core boundary\n", "LCFS = eq.separatrix(ntheta=12)\n", "\n", "# define the null point constraints as the X-points\n", "null_points = [[xpts[0,0], xpts[1,0]], [xpts[0,1], xpts[1,1]]]\n", "\n", "# constrain the core and requested wall point to a common flux surface (i.e. the plasma separatrix)\n", "# --> this is the plasma core, the upper X-point (as plasma is slightly upper single null), and the new strikepoint\n", "isoflux_set = np.array([\n", " [\n", " np.hstack((LCFS[:,0], xpts[0,0], r_strike)).tolist(), \n", " np.hstack((LCFS[:,1], xpts[0,1], z_strike)).tolist(),\n", " ]\n", "])\n", "\n", "# here we will hold the solenoid and P6 currents fixed\n", "eq.tokamak['Solenoid'].control = False\n", "eq.tokamak['P6'].control = False\n", "\n", "# define the PF coil bounds for the coils currents being optimsied (upper, then lower)\n", "# ordering: PX, D1, D2, D3, Dp, D5, D6, D7, P4, P5\n", "coil_current_limits = [\n", " [5e3, 9e3, 9e3, 7e3, 7e3, 5e3, 5e3, 5e3, 0.0, 0.0],\n", " [-5e3, -9e3, -9e3, -7e3, -7e3, -5e3, -5e3, -5e3, -10e3, -10e3]\n", "]\n", "\n", "# initialise the inverse constraints\n", "constrain = Inverse_optimizer(\n", " null_points=null_points,\n", " isoflux_set=isoflux_set,\n", " coil_current_limits=coil_current_limits,\n", ")\n", "\n", "# default parameter for violating PF current limits (higher = stronger penalty)\n", "constrain.mu_coils = 1e5\n", "\n", "# regularisation vector (one for each optimised PF coil)\n", "l2_reg = [1e-12]*10" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# save coil currents for comparison after solve\n", "coil_names = [\n", " coil_name\n", " for coil_name in eq.tokamak.coils_dict\n", " if eq.tokamak[coil_name].control\n", "]\n", "\n", "currents = eq.tokamak.getCurrents()\n", "active_currents_CD = np.array(\n", " [currents[name] for name in coil_names],\n", " dtype=float,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can solve the inverse problem with weak current regularisation, then compare the equilibrium and currents with the CD case. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "GSStaticSolver.solve(\n", " eq=eq, \n", " profiles=profiles, \n", " constrain=constrain, \n", " target_relative_tolerance=1e-6,\n", " target_relative_psit_update=1e-3,\n", " verbose=True,\n", " l2_reg=l2_reg,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plot new equilibrium\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=80)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "constrain.plot(axis=ax1,show=True)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, 2.25)\n", "plt.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# normalisation bounds for the controlled coils.\n", "max_limits = np.asarray(coil_current_limits[0], dtype=float)\n", "min_limits = np.asarray(coil_current_limits[1], dtype=float)\n", "limit_width = max_limits - min_limits\n", "\n", "# prep coil currents for plot\n", "norm_current_CD = (\n", " 2 * (active_currents_CD - min_limits) / limit_width - 1\n", ")\n", "\n", "currents = eq.tokamak.getCurrents()\n", "active_currents_ED = np.array(\n", " [currents[name] for name in coil_names],\n", " dtype=float,\n", ")\n", "\n", "norm_current_ED = (\n", " 2 * (active_currents_ED - min_limits) / limit_width - 1\n", ")\n", "\n", "x = np.arange(len(coil_names))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can see how the coil currents have changed following the leg movement, all still within the bounds. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plot\n", "plt.figure(figsize=(12, 5), dpi=70)\n", "plt.plot(x, norm_current_CD, \"rx-\", label=\"CD currents\")\n", "plt.plot(x, norm_current_ED, \"bx-\", label=\"ED currents\")\n", "\n", "plt.axhline(-1, color=\"k\", label=\"Minimum limit\")\n", "plt.axhline(1, color=\"k\", label=\"Maximum limit\")\n", "\n", "plt.xticks(x, coil_names, rotation=45, ha=\"right\")\n", "plt.ylabel(\"Normalised current\")\n", "plt.title(\"Controlled-coil current proximity to limits\")\n", "plt.grid(True, linestyle=\"--\", alpha=0.6)\n", "plt.legend()\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Super-X Divertor (SXD)\n", "\n", "Using this equilibirum, we can now push the leg further into the SXD configuration - this requires an additional isoflux constraint along the length of the leg. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# new strikepoint location\n", "r_strike = 1.5\n", "z_strike = Z_at_R(line=divertor_line, R=r_strike)\n", "\n", "# nose isoflux constraint needed to ensure leg does not touch upper/lower tiles\n", "nose_r = 0.72\n", "nose_z = -1.55\n", "\n", "# additional constraint along divertor leg\n", "r_leg = 1.15\n", "z_leg = -1.8\n", "\n", "isoflux_set = np.array([\n", " [\n", " np.hstack((LCFS[:,0], xpts[0,0], nose_r, r_leg, r_strike)).tolist(), \n", " np.hstack((LCFS[:,1], xpts[0,1], nose_z, z_leg, z_strike)).tolist(),\n", " ]\n", "])\n", "\n", "# add the extra X-point constraint\n", "null_points = [[xpts[0,0], xpts[1,0]], [xpts[0,1], xpts[1,1]]]\n", "\n", "\n", "# initialise the new constraints\n", "constrain = Inverse_optimizer(\n", " null_points=null_points,\n", " isoflux_set=isoflux_set,\n", " coil_current_limits=coil_current_limits,\n", ")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# show the proposed new strikepoint and leg constrain\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=120)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "ax1.scatter(nose_r, nose_z, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.scatter(r_strike, z_strike, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.scatter(r_leg, z_leg, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, -1)\n", "plt.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# solve\n", "GSStaticSolver.solve(\n", " eq=eq, \n", " profiles=profiles, \n", " constrain=constrain, \n", " target_relative_tolerance=1e-6,\n", " target_relative_psit_update=1e-3,\n", " verbose=True,\n", " l2_reg=l2_reg,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "New we can see the new SXD configuration with coil currents. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# new SXD configuration\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=80)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "constrain.plot(axis=ax1,show=True)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, 2.25)\n", "plt.tight_layout()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice, however, that we have a stray (\"parasitic\") X-point in the divertor chamber. This pushes flux towards the upper part of the chamber, which in many cases can trip machine protection probes. \n", "\n", "To fix this, we can push the X-point away by enforcing some constraints on the normalised flux, i.e. smooth out the poloidal flux lines near the separatrix leg." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# psi norm constraints to get rid of parasitic null point in divertor\n", "\n", "# normalised psi constraints set with format:\n", "# [R, Z, psiN, 1] --> ψ̂(R,Z) ≥ psiN (the +1 or -1 defines ≥ or ≤)\n", "# [R, Z, psiN, -1] --> ψ̂(R,Z) ≤ psiN\n", "psi_norm_limits = [\n", " [1.5, -1.75, 1.15, 1],\n", " [1.5, -1.75, 1.2, -1],\n", "]\n", "\n", "\n", "# initialise the new constraints\n", "constrain = Inverse_optimizer(\n", " null_points=null_points,\n", " isoflux_set=isoflux_set,\n", " coil_current_limits=coil_current_limits,\n", " psi_norm_limits=psi_norm_limits,\n", " mu_psi_norm=1e7, # penalise how much the normalised psi constraint is violated (default 1e6)\n", ")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# show the location of the psi_norm constraint\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=120)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "ax1.scatter(nose_r, nose_z, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.scatter(r_strike, z_strike, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.scatter(r_leg, z_leg, color='deeppink', marker='.', s=90, zorder=5)\n", "ax1.scatter(psi_norm_limits[0][0], psi_norm_limits[0][1], color='brown', marker='.', s=90, zorder=5)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, -1)\n", "plt.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# solve\n", "GSStaticSolver.solve(\n", " eq=eq, \n", " profiles=profiles, \n", " constrain=constrain, \n", " target_relative_tolerance=1e-6,\n", " target_relative_psit_update=1e-3,\n", " verbose=True,\n", " l2_reg=l2_reg,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for psi_con in psi_norm_limits:\n", " sign = \">=\" if psi_con[3] >= 0 else \"<=\"\n", " print(f\"Psi norm at ({psi_con[0]}, {psi_con[1]}) = {eq.psiNRZ(psi_con[0], psi_con[1]):.3f} ({sign} {psi_con[2]})\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# new SXD configuration\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=80)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "constrain.plot(axis=ax1,show=True)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, 2.25)\n", "plt.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# prep coil currents for plot\n", "currents = eq.tokamak.getCurrents()\n", "active_currents_SXD = np.array(\n", " [currents[name] for name in coil_names],\n", " dtype=float,\n", ")\n", "\n", "norm_current_SXD = (\n", " 2 * (active_currents_SXD - min_limits) / limit_width - 1\n", ")\n", "\n", "x = np.arange(len(coil_names))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notice that DP is getting close to the limits! We will monitor this in the next configuation. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plot \n", "plt.figure(figsize=(12, 5), dpi=70)\n", "plt.plot(x, norm_current_ED, \"rx-\", label=\"ED currents\")\n", "plt.plot(x, norm_current_SXD, \"bx-\", label=\"SXD currents\")\n", "\n", "plt.axhline(-1, color=\"k\", label=\"Minimum limit\")\n", "plt.axhline(1, color=\"k\", label=\"Maximum limit\")\n", "\n", "plt.xticks(x, coil_names, rotation=45, ha=\"right\")\n", "plt.ylabel(\"Normalised current\")\n", "plt.title(\"Controlled-coil current proximity to limits\")\n", "plt.grid(True, linestyle=\"--\", alpha=0.6)\n", "plt.legend()\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### X-point Targer Divertor (XPT)\n", "\n", "Next, we can try to place an X-point along the divertor leg. This requires an additional null point constraint and one more isoflux constraint." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# location for the X-point in the lower divertor\n", "xpt_r = 1.38\n", "xpt_z = -1.83\n", "\n", "# add this new point in the null constraints\n", "null_points = [[xpts[0,0], xpts[1,0], xpt_r], [xpts[0,1], xpts[1,1], xpt_z]]\n", "\n", "# we now have the new x-point and nose constraints alongside the core constraints\n", "isoflux_set = np.array([\n", " [\n", " np.hstack((LCFS[:,0], xpts[0,0], xpt_r, nose_r)).tolist(), \n", " np.hstack((LCFS[:,1], xpts[0,1], xpt_z, nose_z)).tolist(), \n", " ]\n", "])\n", "\n", "# initialise\n", "constrain = Inverse_optimizer(\n", " null_points=null_points,\n", " isoflux_set=isoflux_set,\n", " coil_current_limits=coil_current_limits,\n", ")\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# solve\n", "GSStaticSolver.solve(\n", " eq=eq, \n", " profiles=profiles, \n", " constrain=constrain, \n", " target_relative_tolerance=1e-6,\n", " target_relative_psit_update=1e-3,\n", " verbose=True,\n", " l2_reg=l2_reg,\n", ")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we can see the new divertor leg passing nicely into the divertor chamber and ending at the new X-point. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plot\n", "fig1, ax1 = plt.subplots(1, 1, figsize=(4, 8), dpi=80)\n", "ax1.grid(True, which='both')\n", "eq.plot(axis=ax1, show=False)\n", "eq.tokamak.plot(axis=ax1, show=False)\n", "constrain.plot(axis=ax1,show=True)\n", "ax1.set_xlim(0.1, 2.15)\n", "ax1.set_ylim(-2.25, 2.25)\n", "plt.tight_layout()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# prep coil currents for plot\n", "currents = eq.tokamak.getCurrents()\n", "active_currents_SXD = np.array(\n", " [currents[name] for name in coil_names],\n", " dtype=float,\n", ")\n", "\n", "norm_current_XPT = (\n", " 2 * (active_currents_SXD - min_limits) / limit_width - 1\n", ")\n", "\n", "x = np.arange(len(coil_names))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Both DP and D7 are appoaching their limits, so we could have instead made use of the `l2_reg` parameter if need to hold these coil currents more fixed (i.e. we would increase the regularisation on those coils)." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# plot\n", "plt.figure(figsize=(12, 5), dpi=70)\n", "plt.plot(x, norm_current_SXD, \"rx-\", label=\"SXD currents\")\n", "plt.plot(x, norm_current_XPT, \"bx-\", label=\"XPT currents\")\n", "\n", "plt.axhline(-1, color=\"k\", label=\"Minimum limit\")\n", "plt.axhline(1, color=\"k\", label=\"Maximum limit\")\n", "\n", "plt.xticks(x, coil_names, rotation=45, ha=\"right\")\n", "plt.ylabel(\"Normalised current\")\n", "plt.title(\"Controlled coil current proximity to limits\")\n", "plt.grid(True, linestyle=\"--\", alpha=0.6)\n", "plt.legend()\n", "plt.tight_layout()\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "freegsnke", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.20" } }, "nbformat": 4, "nbformat_minor": 4 }